home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #1 / Amiga Plus CD - 1996 - No. 1.iso / pd / netz / xbtx_v1.1 / iorawserial.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-19  |  3.0 KB  |  97 lines

  1. /*
  2. **    $Id: IORawSerial.hpp 1.2 1995/08/19 22:34:29 olsen Exp olsen $
  3. **
  4. **    :ts=4
  5. */
  6.  
  7. /*
  8.  * Copyright © 1995 by Olaf Barthel, All Rights Reserved
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  *
  19.  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
  20.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  21.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  22.  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  25.  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  26.  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  27.  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  28.  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29.  *
  30.  * This software has not been validated by the ``Bundesamt fuer Zulassungen in
  31.  * der Telekommunikation'' of the ``Deutsche Bundepost Telekom'' and thus
  32.  * must not be used for accessing the BTX-Network of the Telekom in Germany.
  33.  *
  34.  * Diese Software hat keine Zulassung durch das Bundesamt fuer Zulassungen in
  35.  * der Telekommunikation der Deutschen Bundespost Telekom und darf daher nicht
  36.  * am Netz der Deutschen Bundespost Telekom in Deutschland betrieben werden.
  37.  */
  38.  
  39. #ifndef _IORAWSERIAL_HPP
  40. #define _IORAWSERIAL_HPP 1
  41.  
  42. #include "IOChannel.hpp"
  43.  
  44. class IORawSerial : public IOChannel
  45. {
  46.     public:
  47.  
  48.         IORawSerial();
  49.         ~IORawSerial();
  50.  
  51.         LONG Open(CONST STRPTR Channel,ULONG Unit=0,ULONG Baud=0,BOOL RTS_CTS=-1);
  52.         VOID Close(VOID);
  53.  
  54.         LONG GetChar(LONG Timeout=0);
  55.         VOID PutChar(UBYTE Char) { PutString((CONST STRPTR)&Char,1); }
  56.         VOID PutString(CONST STRPTR String,LONG Len=-1);
  57.  
  58.         LONG GetCharDirect(LONG Timeout=0) { return(GetChar(Timeout)); };
  59.         VOID PutCharDirect(UBYTE Char) { PutChar(Char); };
  60.         VOID PutStringDirect(CONST STRPTR String,LONG Len=-1) { PutString(String,Len); };
  61.  
  62.         VOID Flush(VOID);
  63.  
  64.         LONG Waiting(VOID);
  65.  
  66.         ULONG WaitMask(VOID);
  67.         VOID Wait(LONG Seconds=1);
  68.  
  69.     private:
  70.         struct IOExtSer     *ReadRequest;
  71.         struct IOExtSer     *WriteRequest;
  72.  
  73.         struct MsgPort        *ReadPort;
  74.         struct MsgPort        *WritePort;
  75.  
  76.         struct MsgPort        *TimePort;
  77.         struct timerequest    *TimeRequest;
  78.  
  79.         ULONG                 ReadMask;
  80.         ULONG                 TimeMask;
  81.         UBYTE                 SingleChar;
  82.  
  83.         BOOL                 Reading;
  84.         BOOL                 Ticking;
  85.         BOOL                 Valid;
  86.  
  87.         VOID StartTime(ULONG Seconds,ULONG Micros=0);
  88.         VOID StopTime(VOID);
  89.         VOID WaitTime(VOID);
  90.  
  91.         VOID StartRead(VOID);
  92.         VOID StopRead(VOID);
  93.         BYTE WaitRead(VOID);
  94. };
  95.  
  96. #endif    // _IORAWSERIAL_HPP
  97.